package com.dd.shop4j.common.utils;

import java.util.List;

/**
 * 分页返回对象
 * 
 * @author tangshu
 * 
 */
public class Page<Entity> {

	private List<Entity> entities;
	private int count;
	private int curpage;
	private int pagesize;
	
	public Page() {
		super();
	}
	
	public Page(List<Entity> entities, int count, int curpage, int pagesize) {
		super();
		this.entities = entities;
		this.count = count;
		this.curpage = curpage;
		this.pagesize = pagesize;
	}

	public List<Entity> getEntities() {
		return entities;
	}

	public void setEntities(List<Entity> entities) {
		this.entities = entities;
	}

	public int getCount() {
		return count;
	}

	public void setCount(int count) {
		this.count = count;
	}

	public int getCurpage() {
		return curpage;
	}

	public void setCurpage(int curpage) {
		this.curpage = curpage;
	}

	public int getPagesize() {
		return pagesize;
	}

	public void setPagesize(int pagesize) {
		this.pagesize = pagesize;
	}

	public int getPage() {
		return count % pagesize == 0 ? count / pagesize : count / pagesize + 1;
	}

}
